import React ,{Component} from "react"
import {Image,FlatList,StyleSheet,Text,View,TouchableOpacity} from "react-native"
var REQUEST_URL = "http://m.maoyan.com/ajax/movieOnInfoList?token=";

import sAdapter from '../tools/screenAdapter'

export default class Loading extends Component{
    constructor(props) {
        super(props);
        this.state = {
            index:-1
        };

    }

    render(): React.ReactNode {
        const {index } = this.state;
        console.log("index ==>",index);
        return <View style={styles.container}>
            {
               this.props.data.map((value,key)=>{
                   return <View style={{backgroundColor:key === index? "#999":"rgba(255,255,255,0.5)"}} key={key}>
                       <Text onPress={()=>{this.setState({index:key}); this.props.click(value,key)}}  style={styles.item} >
                           {value}
                       </Text>
                   </View>
                })
            }

        </View>;
    }

}

var styles = StyleSheet.create({
    container:{
        borderRadius:4,
        marginLeft:"auto",
        marginRight:"auto",
        width: 200,
        marginTop:100,
        borderLeftWidth:1,
        borderLeftColor:"#ccc",
        borderRightWidth:1,
        borderRightColor:"#ccc",
        borderTopWidth:1,
        borderTopColor:"#ccc",

    },
    item:{
        width:198,
        borderBottomWidth:1,
        borderBottomColor:"#ccc",
        lineHeight:48,
        textAlign: "center"
    }

});
